//
//  ShareEarnView.m
//  YTwallet
//
//  Created by ZhangLin on 2019/3/25.
//  Copyright © 2019年 hadrlog. All rights reserved.
//

#import "ShareEarnView.h"
#import <Masonry.h>
@implementation ShareEarnView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self setupViews];
    }
    return self;
}

-(void)setupViews{
    
    self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
    
    self.bottomView =[[UIView alloc] init];
    self.bottomView.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.bottomView];
    [self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.bottom.equalTo(self).offset( - ETTabBarArcHeight);
        make.height.mas_equalTo(54);
    }];
    
    self.cancleBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.cancleBtn setTitle:@"取消" forState:(UIControlStateNormal)];
    [self.cancleBtn setTitleColor:[UIColor colorWithRed:153 / 255.0 green:153 / 255.0 blue:153 / 255.0 alpha:1] forState:(UIControlStateNormal)];
    self.cancleBtn.titleLabel.font = [UIFont systemFontOfSize:16];
    [self.bottomView addSubview:self.cancleBtn];
    [self.cancleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.bottomView);
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.bottom.mas_equalTo(self.bottomView);
        
    }];
    
    
    
    self.weChatView = [[UIView alloc] init];
    self.weChatView.backgroundColor = ETColorWithRGB(244, 244, 244);
    [self addSubview:self.weChatView];
    [self.weChatView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.right.mas_equalTo(0);
        make.bottom.equalTo(self.bottomView.mas_top);
        make.height.mas_equalTo(107);
    }];
    
    self.weChatFriendView = [[UIView alloc] init];
    self.weChatFriendView.backgroundColor = ETColorWithRGB(244, 244, 244);
    [self.weChatView addSubview:self.weChatFriendView];
    [self.weChatFriendView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(0);
        make.bottom.equalTo(self.bottomView.mas_top);
        make.height.mas_equalTo(107);
        make.width.equalTo(self).multipliedBy(1/3.0);
    }];
    
    self.weChatFriendBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.weChatFriendBtn setImage:[UIImage imageNamed:@"icno_weixin"] forState:(UIControlStateNormal)];
    [self.weChatFriendBtn setImage:[UIImage imageNamed:@"icno_weixin"] forState:(UIControlStateHighlighted)];
    [self.weChatFriendView addSubview:self.weChatFriendBtn];
    [self.weChatFriendBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.weChatFriendView);
        make.width.mas_equalTo(40);
        make.height.mas_equalTo(40);
        make.top.mas_equalTo(20);
    }];
    
    self.weChatFriendLab = [[UILabel alloc] init];
    self.weChatFriendLab.text = @"微信好友";
    self.weChatFriendLab.textColor = ETColorWithRGB(51, 51, 51);
    self.weChatFriendLab.font = [UIFont systemFontOfSize:12];
    [self.weChatFriendView addSubview:self.weChatFriendLab];
    [self.weChatFriendLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.weChatFriendBtn);
        make.top.equalTo(self.weChatFriendBtn.mas_bottom).offset(10);
    }];
    
    
    self.circleOfFriendsView = [[UIView alloc] init];
    self.circleOfFriendsView.backgroundColor = ETColorWithRGB(244, 244, 244);
    [self.weChatView addSubview:self.circleOfFriendsView];
    [self.circleOfFriendsView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.weChatFriendView.mas_right);
        make.bottom.equalTo(self.bottomView.mas_top);
        make.height.mas_equalTo(107);
        make.width.equalTo(self).multipliedBy(1/3.0);
    }];
    
    self.circleOfFriendsBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.circleOfFriendsBtn setImage:[UIImage imageNamed:@"icon_pengyouquan"] forState:(UIControlStateNormal)];
    [self.circleOfFriendsBtn setImage:[UIImage imageNamed:@"icon_pengyouquan"] forState:(UIControlStateHighlighted)];
    [self.circleOfFriendsView addSubview:self.circleOfFriendsBtn];
    [self.circleOfFriendsBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.circleOfFriendsView);
        make.width.mas_equalTo(40);
        make.height.mas_equalTo(40);
        make.top.mas_equalTo(20);
    }];
    
    self.circleOfFriendsLab = [[UILabel alloc] init];
    self.circleOfFriendsLab.text = @"微信朋友圈";
    self.circleOfFriendsLab.textColor = ETColorWithRGB(51, 51, 51);
    self.circleOfFriendsLab.font = [UIFont systemFontOfSize:12];
    [self.circleOfFriendsView addSubview:self.circleOfFriendsLab];
    [self.circleOfFriendsLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.circleOfFriendsBtn);
        make.top.equalTo(self.circleOfFriendsBtn.mas_bottom).offset(10);
    }];
    
    
    
    self.saveImageView = [[UIView alloc] init];
    self.saveImageView.backgroundColor = ETColorWithRGB(244, 244, 244);
    [self.weChatView addSubview:self.saveImageView];
    [self.saveImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.circleOfFriendsView.mas_right);
        make.bottom.equalTo(self.bottomView.mas_top);
        make.height.mas_equalTo(107);
        make.width.equalTo(self).multipliedBy(1/3.0);
    }];
    
    
    self.saveImageBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.saveImageBtn setImage:[UIImage imageNamed:@"icon_save"] forState:(UIControlStateNormal)];
    [self.saveImageBtn setImage:[UIImage imageNamed:@"icon_save"] forState:(UIControlStateHighlighted)];
    [self.saveImageView addSubview:self.saveImageBtn];
    [self.saveImageBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.saveImageView);
        make.width.mas_equalTo(40);
        make.height.mas_equalTo(40);
        make.top.mas_equalTo(20);
    }];
    
    self.saveImageLab = [[UILabel alloc] init];
    self.saveImageLab.text = @"保存图片";
    self.saveImageLab.textColor = ETColorWithRGB(51, 51, 51);
    self.saveImageLab.font = [UIFont systemFontOfSize:12];
    [self.saveImageView addSubview:self.saveImageLab];
    [self.saveImageLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.saveImageBtn);
        make.top.equalTo(self.saveImageBtn.mas_bottom).offset(10);
    }];
    
    
    
    
    self.midView = [[UIView alloc] init];
    self.midView.backgroundColor = [UIColor whiteColor];
    self.midView.layer.cornerRadius = 5;
    [self addSubview:self.midView];
    [self.midView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(50);
        make.right.mas_equalTo(-50);
//        make.bottom.mas_equalTo(-210);
        make.centerY.mas_equalTo(self.weChatView.mas_top).multipliedBy(0.5).offset(20);
        make.height.equalTo(self.midView.mas_width).multipliedBy(1.4);
    }];
    
    self.offBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.offBtn setImage:[UIImage imageNamed:@"dialog_icon_off"] forState:(UIControlStateNormal)];
    [self.midView addSubview:self.offBtn];
    [self.offBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-10);
        make.top.mas_equalTo(10);
        make.width.mas_equalTo(20);
        make.height.mas_equalTo(20);
    }];
    
    
    
    
}

@end
